<extend name="Layout/ins_popup" />
<block name="content">
	{:W('PageHeader/popup',array('name'=>'请选择上级节点','search'=>'N'))}
	<input type="hidden" name="val" id="val">
	<input type="hidden" name="name" id="name">
	<div class="operate panel panel-default">
		<div class="panel-body">
			<div class="popup_tree_menu">
				<ul class="tree_menu">
					<li>
						<a node="0"><i class="icon"></i> <span>根节点</span> </a>
						{$menu}
					</li>
				</ul>
			</div>
		</div>
	</div>
</block>
<block name="js">
	<script type="text/javascript">
		function save() {
			if ($("#name").val().length > 0) {
				$("form.common #pid_name", parent.document).val($("#name").val());
				$("form.common #pid", parent.document).val($("#val").val());
			} else {
				ui_error("请选择父级节点");
				return false;
			}
			myclose();
		}

		$(document).ready(function() {
			parent_node = $(".sub_left_menu ul.tree_menu a.active", parent.document).attr("node");
			$("ul.tree_menu a[node='" + parent_node + "']").addClass("disabled");
			$(".popup_tree_menu a:not('.disabled')").click(function() {
				$("#val").val($(this).attr("node"));
				$("#name").val($(this).children("span").text());
				$(".tree_menu a.active").removeClass("active");
				$(this).addClass("active");
			});
		});
	</script>

</block>